package com.google.code.jmarias.client.components;

import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.Image;
import org.newdawn.slick.geom.Vector2f;
import org.newdawn.slick.state.StateBasedGame;

/**
 *
 * @author bart
 */
public class ImageRenderComponent extends AbstractRenderComponent {
    private Image image;

    public ImageRenderComponent(int id, Image image) {
        super(id);
        this.image = image;
    }

    public void render(GameContainer gc, StateBasedGame sb, Graphics gr) {
        Vector2f pos = owner.getPosition();
        float scale = owner.getScale();
        image.draw(pos.x, pos.y, scale);

    }


    public void update(GameContainer gc, StateBasedGame sb, int delta) {
        image.rotate(owner.getRotation() - image.getRotation());
    }

    

}
